package com.investigation.activity.thanks;
import android.os.Bundle;
import android.view.Menu;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;

import com.investigation.R;
import com.investigation.databinding.ActivityThanksBinding;
public class ThanksActivity extends AppCompatActivity {
    private ThanksVM vm;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityThanksBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_thanks);
        vm = new ViewModelProvider(this, new ViewModelProvider.AndroidViewModelFactory(getApplication())).get(ThanksVM.class);
        binding.setVm(vm);
        binding.setLifecycleOwner(this);
        vm.setBinding(binding,this);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_thank, menu);
        menu.getItem(0).setOnMenuItemClickListener(item -> {
            vm.share();
            return false;
        });
        return super.onCreateOptionsMenu(menu);
    }
}
